<?php
namespace Admin\Controller;
use Think\Controller;
/**
 * 后台  管理
 */
class IndexController extends BaseController {

    /**
     *项目列表
     * @return [type] [description]
     */
    public function index(){
        $where=[];
        if(!empty($this->admin_user['proid'])){
            $where='proid in ('.$this->admin_user['proid'].') or creator_id ='.$this->admin_user['id'];
        }
        $data=M('project')->where($where)->select();
        $this->assign('data',$data);
        $this->display("indexNew");
    }
    /**
     * 添加项目
    */
    public function addpro(){
        $pro_name=$this->_param('pro_name','请填写项目名称');
        $ret=M('project')->add(array(
            'pro_name'=>$pro_name,
            'creator_id'=>$this->admin_user['id']
        ));
        if($ret){
            $this->_success('添加成功');
        }
        $this->_internalError('添加失败');
    }
    /**
     * 测试
    */
    public function test(){
        $this->display();
    }
}      